1. Field of the Invention
The present invention relates generally to autofocus camera, and more particularly, to an autofocus method that processes data of lens positions and focus values so as to obtain a lens position at which a sharp image can be captured.
2. Description of Related Art
In the autofocus process of a camera, the lens of the camera is moved from one position to another. At each lens position, the corresponding focus value is calculated. After each movement of the lens, a decision is made as to whether the maximum focus value is obtained.
FIG. 1A is a diagram illustrating the relationship between focus values and lens positions. The peak point H shown in FIG. 1A corresponds to the maximum focus value. FIG. 1B shows a conventional autofocus process. The autofocus process continues until the maximum focus value is found, at which a focused image can be captured. That is, if the ideal lens position is found, the autofocus process terminates; otherwise, the direction and distance of the subsequent movement of the lens are determined, and the steps of moving the lens and calculating the focus value are repeated.
Various algorithms, such as global search, binary search, and rules-based search algorithms, can be applied to search for the lens position that gives rise to maximum focus value.
The global search algorithm records the focus value at each lens movement and goes through all lens positions to exhaustively determine which lens position gives rise to the maximum focus value. Therefore, a reasonably complete plot close to that shown in FIG. 1A is obtained, and the peak point H can be accurately identified. However, the global search algorithm is time consuming.
To overcome the above-described drawback, a two-stage search algorithm has been developed, wherein the search process comprises a coarse search stage and a fine search stage. The coarse search is first performed according to the gradient of the focus values with respect to the lens position so as to estimate which range the peak point H may fall within. Subsequently, a fine search is performed by fitting a second-order quadratic or Gaussian curve to the focus values as a function of lens position within the range of the peak point described above.
Furthermore, US Patent Application No. 20080180563 discloses another autofocus method, wherein a search step look-up table is established in accordance with the total number of lens movements and the corresponding focus values. During the autofocus process, the direction and the distance of lens movements are determined in accordance with the search step look-up table.
Compared with the global search algorithm, the above-described techniques can increase the speed and reduce the number of lens movements. However, all these techniques require parameter adjustment and may not be efficient enough for practical applications. In addition, these techniques may not be able to provide sufficiently accurate results.